r[7<<14];
main(h,t,n,s,a,p)
{
	for(gets(r);~scanf("%d%d",&n,&s);printf("%d\n",a-1e9?a:0))
		for(p=h=t=0,a=1e9;t<n;)
		{
			scanf("%d",r+t);p+=r[t++];
			while(h<=t&&p>=s)
			{
				a=t-h<a?t-h:a;
				p-=r[h++];
			};
		}
}
